//
//  ViewController.m
//  2048
//
//  Created by 高新川 on 15/6/7.
//  Copyright (c) 2015年 高新川. All rights reserved.
//

#import "ViewController.h"
#import "UIColor+Hex.h"
#import "GameViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    [self initWelcome];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 * 初始化开始按钮
 **/
- (void)initWelcome {
    UIButton *start = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    start.frame = CGRectMake(100, 140, 120, 40);
    start.layer.cornerRadius = 10.0;
    [start setTitle:@"开始" forState:UIControlStateNormal];
    start.backgroundColor = [UIColor colorWithHexString:@"0000FF"];
    [start addTarget:self action:@selector(startGame) forControlEvents:UIControlEventTouchDown];
    [self.view addSubview:start];
}

#pragma mark - button action

/*
 * 开始按钮事件
 **/
- (void)startGame {
    GameViewController *game = [[GameViewController alloc] init];
    [self presentModalViewController:game animated:YES];
}

@end
